<template>
	<component ref="form" :is="config.type" :title="config.title" :mode="mode" v-model="_value" v-bind="config.props"
		@input="setValue" />
</template>
<script>
	import components from './ComponentExport.js'

	export default {
		name: "FormItemRender",
		components: components,
		props: {
			mode: {
				type: String,
				default: 'DESIGN'
			},
			value: {
				default: undefined
			},
			config: {
				type: Object,
				default: () => {
					return {}
				}
			},
			render: {
				type: Boolean,
				default: true
			}
		},
		computed: {
			_value: {
				get() {
					return this.value;
				},
				set(val) {
					this.$emit("input", val);
				}
			}
		},
		data() {
			return {}
		},
		mounted() {
		},
		methods: {
			validate(call) {
				this.$refs.form.validate(call)
			},
			setValue(val) {
				this._val = val
			}
		}
	}
</script>

<style lang="scss" scoped>

</style>